digit = ["zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine"]
num = input().split()
def simple(n):
    d = 0
    for i in range(1, n+1):
        if n % i == 0:
            d += 1
    if d == 2:
        return n
    return 0
flag = 0
if len(num) != 3:
    print("Wrong input")
else:
    if num[0] in digit:
        s = digit.index(num[0])
    else:
        flag = 1
    if num[1] in digit:
        d = digit.index(num[1])
    else:
        flag = 2
    if num[2] in digit:
        e = digit.index(num[2])
    else:
        flag = 3
    n = s * 100 + d * 10 + e
    print(simple(n))
